+2005-08-23 Øyvind Kolås <pippin@gimp.org>
+
+ * babl/babl-classes.c,
+ * babl/babl-classes.h,
+ * babl/babl-conversion.c,
+ * babl/babl-fish.h,
+ * babl/babl-image.c,
+ * babl/babl-image.h,
+ * babl/babl-instance.h: Indentation, comments and other cleanup.
+
2005-08-23 Øyvind Kolås <pippin@gimp.org>
* docs/index-static.html.in: update webdocs.
return class_names[klass-BABL_INSTANCE];
}
+/* global variable, indicating whether name lookups
+ * are frowned upon or not (they are frowned upon within BablBase,
+ * since that leads to more strings than neccesary in the library.)
+ */
int babl_hmpf_on_name_lookups = 0;
typedef struct
{
- BablInstance instance;
+ BablInstance instance;
BablConversion **from; /*< NULL terminated list of conversions from class */
BablConversion **to; /*< NULL terminated list of conversions to class */
- int horizontal;
- int vertical;
- char name[4];
+ int horizontal;
+ int vertical;
+ char name[4];
} BablSampling;
typedef struct
{
- BablInstance instance;
+ BablInstance instance;
BablConversion **from; /*< NULL terminated list of conversions from class */
BablConversion **to; /*< NULL terminated list of conversions to class */
- int luma;
- int chroma;
- int alpha;
+ int luma;
+ int chroma;
+ int alpha;
} BablComponent;
typedef struct
{
- BablInstance instance;
- union Babl *source;
- union Babl *destination;
+ BablInstance instance;
+ union Babl *source;
+ union Babl *destination;
} BablFish;
void *destination,
long n)
{
+ /*TODO: build planar formats if needed when linear pointers are passed in */
assert (BABL_IS_BABL (conversion));
switch (BABL(conversion)->class_type)
BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish)
-Babl *
-babl_fish (Babl *source,
- Babl *destination);
+/** create a new BablFish capable of translating between the pixel
+ * formats given in source and destination. (use babl_pixel_format (string))
+ */
+Babl * babl_fish (Babl *source,
+ Babl *destination);
-/* babl_fish_process will probably be a polymorph function
- * accepting source and destination buffer pointers will be
- * allowed as well as BablImage objects in their place
+/* Transform n pixels from source into destination,
+ * source and destination can be pointers to linear buffers
+ * (or at a later stage of babl development BablImages)
*/
-int
-babl_fish_process (Babl *babl_fish,
- void *source,
- void *destination,
- int n);
+int babl_fish_process (Babl *babl_fish,
+ void *source,
+ void *destination,
+ int n);
/* whether the BablFish needs a BablImage to do the processing,
- * or void * are sufficient.
+ * or a void pointer to a linear buffer is sufficient.
*/
-int
-babl_fish_needs_image (Babl *babl_fish);
+int babl_fish_needs_image (Babl *babl_fish);
#endif
#define BABL_MAX_BANDS 32
-static BablImage *db[100]={NULL,};
-
-#if 0
-static int
-each_babl_image_destroy (Babl *babl,
- void *data)
-{
- babl_free (babl);
-
- return 0; /* continue iterating */
-}
-#endif
-
static Babl *
image_new (int bands,
BablComponent **component,
babl->image.data = ((void *)babl->image.component) + sizeof (BablComponent*) * (bands+1);
babl->image.pitch = ((void *)babl->image.data) + sizeof (void*) * (bands+1);
babl->image.stride = ((void *)babl->image.pitch) + sizeof (int) * (bands+1);
-/*babl->image.foo = ((void *)babl->image.stride) + sizeof (int) * (bands+1);*/
babl->class_type = BABL_IMAGE;
babl->instance.id = 0;
return babl;
}
-void
-babl_image_each (BablEachFunction each_fun,
- void *user_data)
-{
- int i;
- return;
-
- while (db[i])
- {
- if (each_fun ((Babl *) (db[i]), user_data))
- {
- return;
- }
- else
- {
- i++;
- }
- }
-}
-
-
void
babl_image_destroy (void)
{
+ /* nothing to do */
}
void
babl_image_init (void)
{
+ /* nothing to do */
}
#include "babl-classes.h"
-void babl_image_init (void);
-void babl_image_introspect (void);
-void babl_image_each (BablEachFunction each_fun,
- void *user_data);
-void babl_image_destroy (void);
-Babl * babl_image_new (void *first_component,
+/* babl images are allocated as a single chunk of memory, and
+ * thus can be duplicated using duplicate = babl_dup (original);
+ *
+ * NB: babl_fish_process () frees the images passed in by itself.
+ */
+Babl * babl_image_new (void *first_component,
...);
/* create a new BablImage based on a packed BablPixelFormat (or BablModel which
* is a virtual pixelformat based on the BablModel using only doubles in the
* order they are listed in the model.
*/
-Babl *
-babl_image_new_from_linear (void *buffer,
- Babl *format);
+Babl * babl_image_new_from_linear (void *buffer,
+ Babl *format);
+
#endif
* headers to a minimum, only the ones overriding the basic api with
* custom ways of construction.
*/
-#define BABL_DEFINE_CLASS(type_name) \
- \
+#define BABL_DEFINE_CLASS(type_name) \
+ \
void type_name##_init (void); \
void type_name##_destroy (void); \
void type_name##_each (BablEachFunction each_fun, \
Babl * type_name##_id (int id); \
Babl * type_name##_new (const char *name, \
...);
-#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name) \
- \
+#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name) \
+ \
void type_name##_init (void); \
void type_name##_destroy (void); \
void type_name##_each (BablEachFunction each_fun, \
return class_names[klass-BABL_INSTANCE];
}
+/* global variable, indicating whether name lookups
+ * are frowned upon or not (they are frowned upon within BablBase,
+ * since that leads to more strings than neccesary in the library.)
+ */
int babl_hmpf_on_name_lookups = 0;